package dieci.managers.rawmaterial;

import dieci.database.rawmaterial.RawMaterialProductHibernateDAO;
import dieci.system.Product;
import dieci.system.RawMaterial;
import dieci.system.RawMaterialProduct;
import java.util.List;

/**
 *
 * @author DuckSys
 */
public class RawMaterialProductManager
{

    public RawMaterialProductManager()
    {
        this.rawMaterialDAO = new RawMaterialProductHibernateDAO();
    }

    public void saveRawMaterialProduct(RawMaterialProduct rawMaterial)
    {
        //call dao to save the rawMaterial in db
        rawMaterialDAO.saveOrUpdate(rawMaterial);
    }

    public void deleteRawMaterialProduct(RawMaterialProduct rawMaterial)
    {
        rawMaterialDAO.delete(rawMaterial);
    }

    public List<RawMaterialProduct> findByProduct(Product product)
    {
        return rawMaterialDAO.findByProduct(product);
    }

    public List<RawMaterialProduct> findByRawMaterial(RawMaterial rawMaterial)
    {
        return rawMaterialDAO.findByRawMaterial(rawMaterial);
    }
    
    public RawMaterialProduct findById(long prodId, int rawMatId)
    {
        return rawMaterialDAO.findById(prodId, rawMatId);
    }
    
    public List<RawMaterialProduct> list()
    {
        return rawMaterialDAO.list();
    }
        
    
    private RawMaterialProductHibernateDAO rawMaterialDAO;
}
